package app.server.project.main.service.service.lang;

import app.server.project.main.service.db.dao.cfg.LangCfgDao;
import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Objects;

@AllArgsConstructor
@Service
public class LangService {

    private LangCfgDao langCfgDao;

    public String getVal(long langId, String langType) {
        var cfg = this.langCfgDao.getLangId(langId, langType);
        if (Objects.nonNull(cfg)) {
            if (StrUtil.isBlank(cfg.getVal())) return StrUtil.EMPTY;
            return cfg.getVal();
        } else {
            return StrUtil.EMPTY;
        }
    }
}
